package Structural_design_pattern.Composite_Pattern.Example1;

// 菜单项类(叶子节点)
public class MenuItem extends MenuComponent{
    public MenuItem(String name, int level){
        this.name = name;
        this.level = level;
    }
    @Override
    public void print(){
        for(int i = 0; i < level; i++){
            System.out.print("--");
        }

        // 只打印菜单项名称
        System.out.println(name); 
    }
    
}
